1 /**
2 * Copyright 2005-2013 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.kuali.rice.core.test;
17
18 import java.lang.annotation.Documented;
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Inherited;
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 import java.lang.annotation.Target;
24
25 import org.junit.Test;
26 import org.kuali.rice.test.data.PerSuiteUnitTestData;
27 import org.kuali.rice.test.data.PerTestUnitTestData;
28 import org.kuali.rice.test.data.UnitTestData;
29
30 /**
31 * DataLoaderAnnotationOverrideTest is used to test the annotation data entry provided by {@link UnitTestData}, {@link PerTestUnitTestData}, and {@link PerSuiteUnitTestData}
32 *
33 * @author Kuali Rice Team (rice.collab@kuali.org)
34 *
35 */
36 @PerSuiteUnitTestData(
37 overrideSuperClasses = true,
38 value = {@UnitTestData("insert into " + AnnotationTestParent.TEST_TABLE_NAME + " (COL) values ('3')"),
39 @UnitTestData(filename = "classpath:org/kuali/rice/test/DataLoaderAnnotationTestData.sql")
40 })
41 @DataLoaderAnnotationOverrideTest.Nothing
42 public class DataLoaderAnnotationOverrideTest extends AnnotationTestParent {
43 // a dummy annotation to test that data loading annotations work in presence of
44 // other annotations
45 @Documented
46 @Target({ElementType.TYPE, ElementType.METHOD})
47 @Retention(RetentionPolicy.RUNTIME)
48 @Inherited
49 public static @interface Nothing {
50 }
51
52 @Test public void testParentAndSubClassImplementation() throws Exception {
53 // verify that the sql only ran once...
54
55 // check sql statement from this class
56 verifyCount("3", 1, "https://jira.kuali.org/browse/KULRICE-9283");
57
58 // check sql file from this class
59 verifyCount("4", 1);
60
61 // check sql statement from parent class
62 verifyNonExistent("1");
63
64 // check sql file from parent class
65 verifyNonExistent("2");
66 }
67
68 }