1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.test.lifecycles;
17
18 import org.kuali.rice.core.api.lifecycle.Lifecycle;
19 import org.kuali.rice.core.api.lifecycle.Lifecycle;
20 import org.kuali.rice.test.RiceTestCase;
21 import org.kuali.rice.test.data.PerSuiteUnitTestData;
22 import org.kuali.rice.test.data.UnitTestData;
23 import org.kuali.rice.test.data.UnitTestDataUtils;
24
25
26
27
28
29
30
31
32 public class PerSuiteDataLoaderLifecycle implements Lifecycle {
33 private boolean started;
34
35 private Class<? extends RiceTestCase> annotatedClass;
36
37 public PerSuiteDataLoaderLifecycle(Class<? extends RiceTestCase> annotatedClass) {
38 this.annotatedClass = annotatedClass;
39 }
40
41 public boolean isStarted() {
42 return started;
43 }
44
45 public void start() throws Exception {
46 if (annotatedClass.isAnnotationPresent(PerSuiteUnitTestData.class)) {
47 UnitTestData[] data = annotatedClass.getAnnotation(PerSuiteUnitTestData.class).value();
48 UnitTestDataUtils.executeDataLoader(data);
49 }
50 started = true;
51 }
52
53 public void stop() throws Exception {
54 started = false;
55 }
56
57 }